home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 October / pcx14_9710.iso / swag / delphi.swg / 0053_Accessing DOS Environment data from Delp.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-11-24  |  505 b   |  31 lines

  1.  
  2. {I saw someone asking how to get DOS environment variables from Delphi.
  3. The little Project attached shows how to list all the Environment
  4. variables quite simply.}
  5.  
  6. program Getenv;
  7.  
  8. uses WinCrt,
  9.   WinProcs;
  10. var
  11.  ptr: PChar;
  12.  Done: BOOLEAN;
  13. begin
  14.  ptr := GetDOSEnvironment;
  15.  Done := FALSE;
  16.  WHILE NOT Done DO
  17.  BEGIN
  18.   IF ptr^ = #0 THEN
  19.   BEGIN
  20.    Writeln;
  21.    INC(ptr);
  22.    IF ptr^ = #0 THEN Done := TRUE
  23.    ELSE Write(ptr^);
  24.   END
  25.   ELSE Write(ptr^);
  26.   INC(ptr);
  27.  END;
  28. end.
  29.  
  30.  
  31.